﻿using CharacterCreation.Data.Models;

namespace CharacterCreation.Data.Services {
    public class SkillService : BaseService<Skill, SkillService> {
        public override void SaveCurrentItem() {
            save(this.CurrentItem);
        }

        public override void SaveNewItem() {
            var temp = this.NewItem;
            save(temp);
            this.Items.Add(temp);
            this.CurrentItem = temp;

            ClearNewItem();
        }

        private void save(Skill skill) {
            DataContext.Store(skill.Statistics);
            DataContext.Store(skill);
        }
    }
}
